[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
twLineMenu( nRow, nStartCol, nEndCol, aItems, nChoice,;
wColor, nExitKey, lFreeze, lSound, bPrerun,;
bPostrun, lWindow, wSType, wFType, wFColor )
----------------------------------------------------------------------------
Display and operate an expandable line menu. This menu can be
displayed with or without a window. The choices are padded to
equal widths.
If no window is chosen, (the default) the display is as follows:
+---------- More Items Indicators------------+
| |
nRow -- .three four five six .
| |
+-- nStartCol nEndCol--+
If lWindow is TRUE:
+---------- More Items Indicators-----------------+
| |
nRow -- +---------------------------------------------------+
|. Cherry Strawberry Black Currant .|
+---------------------------------------------------+
| |
+-- nStartCol nEndCol--+
You can hold as many items in the menu as you can fit into memory.
twLineMenu() is a relatively small menu system handy for making
choices out of large sets of data. Do not use it for your small
choice operations. It is too big for that.
Key Handling:
The default exit keys are:
ENTER - Return current selection.
ESC - Return zero.
Mouse Support:
twLineMenu() supports double clicks for selection, single clicks
for cursor movement and the More Items Indicators are also
moused.
Arguments:
nRow - 'N' Screen row on which to display the menu. If
lWindow is TRUE, the window, a three line window
starts on nRow and the menu is on the centre line
of the window. The default is line 24.
nStartCol - 'N' Starting screen column for the browse. The menu is
displayed beginning at nStartCol + 1 so that the
'More Items Indicator' can be displayed in the
first position. If lWindow is TRUE, the window
begins at nStartCol and the menu is adjusted
accordingly. The default is zero.
nEndCol - 'N' Ending screen column for the browse. The menu is
displayed beginning at nEndCol - 1 so that the
'More Items Indicator' can be displayed in the
last position. If lWindow is TRUE, the window ends
at nEndCol and the menu is adjusted accordingly.
The default is MAXCOL().
aItems - 'A' Array of choices.
nChoice - 'N' Starting choice number. This parameter defaults to
the first item.
wColor - 'C' Color string for the menu item display in the
form:
"w+/b,gr+/r"
The second element is used for the highlight. The
default is SETCOLOR().
nExitKey - 'N' An optional exitkey to exit the menu. nExitkey
exits with the current choice. The default exit
keys are:
ENTER - Return current selection.
ESC - Return zero.
lFreeze - 'L' twLineMenu() is a TBrowse. You may, if you wish,
freeze the browse. If you do, the items will be
frozen against the left more items indicator
marker. All choices are displayed with the same
column width in twLineMenu(). The default is .T.
lSound - 'L' Optional logical for sound when you hit either end
of the bar. The default is .F.
bPrerun - 'B' Optional code block to execute before the menu
operates. If you have lWindow set to TRUE, you can
add a title to the window using bPreRun.
bPostrun - 'B' Optional code block to execute after exiting the
menu.
lWindow - 'L' Optional logical for display of the menu in a
window. The default is .F.
wSType - 'N' If lWindow is TRUE, you may set the shadow type
with a TSDWIN shadow type.
wFType - 'N' TSDWIN frame type.
wFColor - 'C or A' TSDWIN frame colour.
Return:
Current choice or zero for exit with no choice.
Example:
FUNCTION Main()
#include "tsdwin.ch"
LOCAL aItems := { "one","two","three","four",;
"five","six","seven","eight",;
"nine","ten","eleven","twelve",
"thirteen","fourteen","fifteen"}
LOCAL nChoice := 1, nRow := 1
LOCAL nStartCol := 1, nEndCol := MAXCOL() - 1
LOCAL nStart := 0
SETCOLOR( "w+/b,gr+/r,,bg+/b,n/w" )
twOpen()
twTitle( "Testing twLineMenu()", "n/w", "B", "C" )
DO WHILE .T.
nStart := twInquire( "Enter Starting Choice",, nStart )
nChoice := twLineMenu( nRow, nStartCol, nEndCol, aItems, nStart )
IF nChoice = 0
EXIT
ENDIF
twInfo( "You Chose " + aItems[ nChoice ] )
ENDDO
aItems := {}
USE Windemo
DBEVAL( {|| AADD( aItems, " " + ;
TRIM( Windemo->Ice_Cream ) )})
DO WHILE .T.
nChoice := twLineMenu( ;
nRow, nStartCol + 2, nEndCol - 2,;
aItems,, "n/bg,gr+/r";
,, .F.,,;
{|| twTitle( "Window Test", "gr+/r" ) },;
, .T., 3, 4, { "n/bg", "w/bg" } )
IF nChoice = 0
EXIT
ENDIF
twInfo( "You Chose " + aItems[ nChoice ] )
ENDDO
RETURN NIL
See Also:
twMenuTo()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson